package com.hzya.frame.controller;

import com.hzya.frame.entity.JsonResultEntity;
import com.hzya.frame.unifiedEntry.service.IUnifiedEntryService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

@Controller
@RequestMapping("/entranceController")
public class EntranceController {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private IUnifiedEntryService unifiedEntryService;

    @RequestMapping("/queryTest")
    @ResponseBody
    public String queryTest() {
        logger.info("请求成功info11112312312311111");
        logger.error("请求成功error");
        return "请求成功";
    }

    /**
     * @param servletRequest
     * @param servletResponse
     * @Description 请求统一入口
     **/
    @RequestMapping(value = "/option")
    @ResponseBody
    public JsonResultEntity option(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
        return unifiedEntryService.doBusiness(servletRequest, servletResponse);
    }
}
